namespace Web.Control.WWW.Learn
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI;
	using System.Web.Security;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.Text.RegularExpressions;
	using System.Text;
    using Lx.Web.Common.UI;
    using Lx.Web.Common.ControlsUI;
	using System.Collections;
	using System.IO;
	using System.Xml;
	using System.Xml.Schema;


	public class LanguageList : BaseControl
	{
		
		protected DataList dList1;
        protected DataList dList2;
		protected Literal LanguageLabel;
		protected DropDownList Language;

		protected override void OnLoad(EventArgs e)
		{
            if (!Page.IsPostBack)
            {
                DataTable dt = base.GetDTFromXml("Languages.xml");
                dt.Columns[0].ColumnName = "LanguageValue";
                dt.Columns[1].ColumnName = "LanguageText"; 
                //DataView dv = null;
                if (dList1 != null)
                {
                    DataTable dt1 = dt.Clone();
                    for (;; )
                    {
                        
                        DataRow dr = dt.Rows[0];
                        if (dr["LanguageValue"].ToString().Trim() == "") break;
                        dt1.ImportRow(dr);
                        dt.Rows.Remove(dr);
                    }
                    dList1.DataSource = dt1;
                    dList1.DataBind();
                }
                if (dList2 != null)
                {
                    for (int i = dt.Rows.Count - 1; i > -1;i-- )
                    {
                        if (dt.Rows[i]["LanguageValue"].ToString().Trim() == "")
                        {
                            dt.Rows.Remove(dt.Rows[i]);
                        }
                    }
                    dList2.DataSource = dt;
                    dList2.DataBind();
                    //DataTable dt2 = new DataTable("dtr");
                    //dt2.Columns.Add("LanguageValue");
                    //dt2.Columns.Add("LanguageText");
                    //for (int i = 0; i < dt.Rows.Count; i++)
                    //{
                    //    DataRow dr2 = dt2.NewRow();
                    //    dr2[0] = dt.Rows[i][0].ToString();
                    //    dr2[1] = dt.Rows[i][1].ToString();
                    //    dt2.Rows.Add(dr2);
                    //}
                    //dv = new DataView();
                    //dv.Table = dt2;
                    //dv.RowFilter = " LanguageValue<>''";
                    //dv.Sort = "LanguageText ";                     
                    //dList2.DataSource = dv;
                    //dList2.DataBind();
                }
            }
		}

	}

}
